package com.starsoft.frame.util;

public class NumberUtil {
	public static Double null2Zero(Double value) {
		if (value == null) {
			return 0.0;
		} else {
			return value;
		}
	}
	
	public static Integer null2Zero(Integer value) {
		if (value == null) {
			return 0;
		} else {
			return value;
		}
	}
	
	public static Double addNullable(Double... values) {
		double result = 0;
		for (int i = 0; i < values.length; i++) {
			result += null2Zero(values[i]);
		}
		return result;
	}
}
